<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>while循环</title>
  <script type="text/javascript">
	//循环打印1-10数据
	/*var x = 1;
	while(x<=10){
		document.write(x+"<br/>");
		x=x+1;
	}*/

	//打印1-10中的偶数
	/*var y = 1;
	while(y<=10){
		if(y%2==0){
			document.write(y+"<br/>");
		}
		y++; //等同于y=y+1;
	}*/

	//打印1+2+3+...+100=5050
	/*var x = 1;
	var count =0;
	while(x<=100){
		count = count+x;
		x++;
	}
	document.write("求和为："+count+"<br/>");*/



  </script>
 </head>
 <body>
  
 </body>
</html>
